define(function(require, exports, module) {
	"use strict";
	require("../../dep/mui/js/mui.min.js");
	require("../jquery-3.1.1.min.js");
	require("../mui.picker.min.js");
	require("../dateShow.js");
	require("./dateInput.js");
	var globalInit = require("globalInit"); //共用js
	var muiTips = require("muiTips");
	require("keepDate");
	var template = require("template");
	var jurisdictionOrder = require("jurisdictionOrder"); //引入是否超量配置
	var abpUse = require("../abp.js");
	mui.init({
		swipeBack: true //启用右滑关闭功能
	});
	var abp = abpUse.abpstart;

	var sourceType = 0;
	var sourceSerial = "";
	var sourceId = 0;
	var updateSell = require("./updateSell");

	//接收采购记录详情页传过来的生成采购入库单数据
	if(sessionStorage.getItem('sellId') && sessionStorage.getItem('serialNo') && sessionStorage.getItem('salDetID')) {
		sourceType = Number(abp.sourceType.SELL);
		sourceSerial = sessionStorage.getItem('serialNo');
		sourceId = Number(sessionStorage.getItem('sellId'));
	}
	var getFunList = require("../getFunList/getFunList.js"); //函数配置js

	getFunList.addGoodsInfoList("goodsList", "#goodsListShow"); //新增订单选择货品列表展示	
	getFunList.choiceInfo(); //选择信息缓存

	$(function() {
		//销售出库订单ID
		var salesOutId = sessionStorage.getItem("salesOutId");

		var jsonData = JSON.parse(sessionStorage.getItem("sellData"));

		//接收采购记录详情数据
		if(jsonData) {

			updateSell.deleteUpdateGoodsDetail({
				"update": ".update-trash", //删除按钮
				"goodsInList": ".goodsIn-list", //移除页面元素
				"data": jsonData,
				"updateArr": jsonData.sellDetail,
				"sellData": "sellData" //需要存储的数组对象
			}, hideList);
			sellDataDetail();

		}

		function sellDataDetail() {
			$("#staff-user").text(jsonData.busUserName);
			$("#staff-user").attr("data-id", jsonData.busUserId);

			//负责人	
			mui("body").on("tap", "#staff-user", function() {
				session();
			});

			function session() {
				jsonData.busUserName = $("#staff-user").text();
				jsonData.busUserId = $("#staff-user").attr("data-id");
				sessionStorage.setItem("sellData", JSON.stringify(jsonData));
			}
			$("#headUL li a").eq(0).addClass('mui-disabled');
			$("#headUL li a").eq(1).addClass('mui-disabled');
			$("#headUL li a span").eq(1).addClass('mui-disabled');
			$("#headUL li a").eq(2).addClass('mui-disabled');
			$("#headUL li a").eq(3).addClass('mui-disabled');

			$("#client").text(jsonData.companyName);
			$("#client").attr("data-id", jsonData.companyId);
			$("#valorem").text(jsonData.taxRateTypeName);
			$("#valorem").attr("data-id", jsonData.taxRateType);
			$(".remarks").val(jsonData.notes);
			//模板
			var html = template('goodsInfo', jsonData);
			$("#goodsListShow").prepend(html);
			$("#lastInfo").show();
			$("#goodsListShow").show();
			$("#sub-btn").show();
			$('.setParm').parent('li').hide();
			//计算金额
			settlement();
			mui('body').on('tap', 'header > button', function() {
				clearSession();
			});
		}
		//计算数量与金额 删除明细
		if(sessionStorage.goodsInfoList) {
			//计算总数量与金额
			updateSell.allnumAndAllMoney();
			//删除订单明细
			var goodsLists = JSON.parse(sessionStorage.goodsInfoList);
			updateSell.deleteGoodsDetail({
				"delete": ".delete-trash", //删除按钮
				"array": goodsLists, //需要删除的数组
				"goodsIn": ".goodsIn", //移除页面元素
				"goodsInfoList": "goodsInfoList", //需要存储的数组对象
			}, hideList);
		}

		//编辑销售出库记录
		var salesData = JSON.parse(sessionStorage.getItem("salesData"));
		var salesSourceType = sessionStorage.getItem("salesSourceType");
		//删除编辑状态下的订单明细
		if(salesData) {
			updateSell.deleteUpdateGoodsDetail({
				"update": ".update-trash", //删除按钮
				"goodsInList": ".goodsIn-list", //移除页面元素
				"data": salesData, //需要修改的对象
				"updateArr": salesData.sellOutputDetail, //需要更改的货品明细数组
				"sellData": "salesData" //需要存储的数组对象
			}, hideList);
			sellOutputDetail();

		} else {
			updateSell.sellOutSeriaNo();
		}

		function sellOutputDetail() {
			$("#sub-btn").show();
			updateSell.updateModel({
				"sellData": salesData, //后台数据
				"code": "#code", //编号标签ID
				"createDate": ".createDate", //创建时间
				"companyName": "#client", //供应商标签ID
				"busUserName": "#staff-user", //负责人标签ID
				"valorem": "#valorem", //计税方式标签ID
				//				"goodsInfo" : "goodsInfo",				//货品template模板ID
				"goodsListShow": "#goodsListShow", //mainID
				"lastInfo": "#lastInfo", //总金额父盒子
				"allNumber": "#goodsListShow .goodsNum", //总数量
				"allMoney": "#goodsListShow .product-money", //总金额
				"allNum": "#allNum", //总数量赋值
				"allPrice": "#allPrice", //总金额
				"notes": "#notes"
			});
			//渲染后台数据页面
			var dataList = {};
			dataList.sellDetail = salesData.sellOutputDetail;
			var html = template("goodsInfo", dataList);
			$("#goodsListShow").show();
			$("#goodsListShow").prepend(html);

			//点击客户
			mui("body").on("tap", "#client", function() {
				session();
			});
			//负责人	
			mui("body").on("tap", "#staff-user", function() {
				session();
			});
			//计税方式
			mui("body").on("tap", "#valorem", function() {
				session();
			});
			//点击选择货品
			mui("body").on("tap", "#chioce-product", function() {
				session();
			});
			//点击货品明细存储值
			mui("body").on("tap", "#goodsListShow li", function() {
				session();
			});

			function session() {
				salesData.serialNo = $("#code").text();
				salesData.dataCreated = $(".createDate").text();
				salesData.deliveryDate = $(".lastDate").text();
				salesData.companyName = $("#client").text();
				salesData.companyId = $("#client").attr("data-id");
				salesData.busUserName = $("#staff-user").text();
				salesData.busUserId = $("#staff-user").attr("data-id");
				salesData.taxRateType = $("#valorem").attr("data-id");
				salesData.taxRateTypeName = $("#valorem").text();
				sessionStorage.setItem("salesData", JSON.stringify(salesData));
			}
			updateSell.allnumAndAllMoney();

			if(salesSourceType) {
				//不允许修改与添加
				$("#headUL li a").eq(0).addClass('mui-disabled');
				$("#headUL li a").eq(1).addClass('mui-disabled');
				$("#headUL li a span").eq(1).addClass('mui-disabled');
				$("#headUL li a").eq(2).addClass('mui-disabled');
				$("#headUL li a").eq(3).addClass('mui-disabled');
				$(".choice>li").hide();
				$(".choice>li>.setParm").addClass('mui-disabled');
			}
		}

		//选择客户 税率 以及负责人
		var chioceInfo = require("./chioceInfo.js");
		chioceInfo.chioceMore();

		//隐藏现实按钮与货品详情
		hideList();

		function hideList() {
			//			
			if($("#goodsListShow .product-money").length > 0) {
				$("#lastInfo").show();
				$("#goodsListShow").show();
			} else {
				$("#lastInfo").hide();
				$("#goodsListShow").hide();
			}
			if(($("#goodsListShow .product-money").length > 0) && $("#client").attr("data-id") && $("#valorem").attr("data-id") && $("#staff-user").attr("data-id")) {

				$("#sub-btn").show();
			} else {
				$("#sub-btn").hide();
			}

		}

		function sellOrder(statusId) { //请求函数
			var outBuyInputDetail = [];
			var serialNo = $("#code").text().trim();
			var dataCreated = $(".createDate").text().trim(); //创建日期
			//			var deliveryDate=$(".lastDate").text().trim();	  //预交日期
			var notes = $(".remarks").val().trim();
			var companyId = Number($("#client").attr("data-id"));
			var busUserId = Number($("#staff-user").attr("data-id"));
			var taxRateType = $("#valorem").attr("data-id");
			var discount = $(".discount").val() / 100;

			var dataModel = {
				"isStatement": false, //(boolean, optional): 是否结算id ,
				"sellOutputDetail": outBuyInputDetail, //  (Array[SellOutputDetailInput], optional): 销售出库单明细集合属性 ,
				"serialNo": serialNo, //  (string): 单号 ,
				"serialDate": dataCreated, //  (string): 单据日期 ,
				"companyId": companyId, //  (integer): 客户Id ,
				"busUserId": busUserId, //  (integer): 业务员Id ,
				"deptId": 0, //  (integer): 业务部门Id ,
				"taxRateType": taxRateType, //  (integer): 计税方式Id ,
				"currencySerial": "RMB", //(string, optional): 币别 ,
				"currencyName": "人民币", //(string, optional): 币别名称 ,
				"currencyRate": 1, //  (number): 汇率 ,
				"notes": notes, //  (string, optional): 备注 ,
				"contactId": 0, //  (integer): 联系人Id ,
				"statusId": statusId, //  (integer, optional): 单据状态Id ,
				"isClosed": false, //  (boolean, optional): 是否结案Id ,
				"id": salesOutId // (integer, optional): Id
			};

			if(!sessionStorage.getItem("sellData")) {
				var productionList = $(".production-list");
				for(var i = 0; i < productionList.length; i++) {
					var whId = Number($(".production-list").eq(i).find(".warehouse").data("id"));
					var goodsId = Number($(".production-list").eq(i).find(".clothes-code").data("id"));
					var goodsUnit = $(".production-list").eq(i).find(".clothes-code").data("unit");
					var price = Number($(".production-list").eq(i).find(".price").text());
					var goodsNum = Number($(".production-list").eq(i).find(".goodsNum").text());
					var taxes = Number($(".production-list").eq(i).data("taxes"));
					var discount = Number($(".production-list").eq(i).data("discount"));
					var notes = $(".production-list").eq(i).data("notes");
					var SellOutputDetailInput = {
						"storageId": 0, // (integer): 仓位Id ,
						"sourceType": 0, //  (integer): 来源类型Id ,
						"sourceSerial": "", //  (string): 来源单号 ,
						"sourceId": 0, //  (integer): 来源单Id ,
						"sourceItemId": 0, //  (integer): 来源单明细Id ,
						"batchDetail": [], //  (Array[BatchDetailInput], optional): 批号明细集合属性 ,
						"whId": whId, //  (integer): 仓库Id ,
						"goodsId": goodsId, //  (integer): 货品Id ,
						"unit": goodsUnit, //  (string): 主单位 ,
						"price": price, //  (number): 单价 ,
						"unitCode": goodsUnit, //  (string): 副单位 ,
						"unitCodeNumber": goodsNum, //  (number): 副单位数量 ,
						"taxRate": taxes, //  (number): 税率 ,
						"unitCodeConvertRate": 1, //  (number): 副单位转换率 ,
						"discount": discount, //  (number): 折扣率 ,
						"isGift": false, //  (boolean): 是否赠品Id ,
						"notes": notes, //  (string, optional): 备注 ,
						"unitCodeAssist": " ", //  (string, optional): 辅单位 ,
						"unitCodeNumberAssist": 0, //  (number, optional): 辅单位数量 ,
						"unitCode1": "", //  (string, optional): 副单位1 ,
						"unitCodeNumber1": 0, //  (number, optional): 副单位1数量 ,
						"unitCodeConvertRate1": 0, //  (number, optional): 副单位1转化率 ,
						"unitCode2": "", //  (string, optional): 副单位2 ,
						"unitCodeNumber2": 0, //  (number, optional): 副单位2数量 ,
						"unitCodeConvertRate2": 0, //  (number, optional): 副单位2转换率 ,
						"id": 0 //  (integer, optional): Id
					};
					//					dataModel.sellOutputDetail.push(SellOutputDetailInput);
					outBuyInputDetail.push(SellOutputDetailInput);
				}
			} else {
				var goodsLists = jsonData.sellDetail;
				for(var i = 0; i < goodsLists.length; i++) {
					var SellOutputDetailInput = {
						"storageId": 0, // (integer): 仓位Id ,
						"sourceType": sourceType, //  (integer): 来源类型Id ,
						"sourceSerial": sourceSerial, //  (string): 来源单号 ,
						"sourceId": sourceId, //  (integer): 来源单Id ,
						"sourceItemId": goodsLists[i].id, //  (integer): 来源单明细Id ,
						"batchDetail": [], //  (Array[BatchDetailInput], optional): 批号明细集合属性 ,
						"whId": goodsLists[i].whId, //  (integer): 仓库Id ,
						"goodsId": goodsLists[i].goodsId, //  (integer): 货品Id ,
						"unit": goodsLists[i].unit, //  (string): 主单位 ,
						"price": goodsLists[i].price, //  (number): 单价 ,
						"unitCode": goodsLists[i].unitCode, //  (string): 副单位 ,
						"unitCodeNumber": goodsLists[i].unitCodeNumber, //  (number): 副单位数量 ,
						"taxRate": Number(goodsLists[i].taxRate), //  (number): 税率 ,
						"unitCodeConvertRate": 1, //  (number): 副单位转换率 ,
						"discount": Number(goodsLists[i].discount), //  (number): 折扣率 ,
						"isGift": false, //  (boolean): 是否赠品Id ,
						"notes": goodsLists[i].notes, //  (string, optional): 备注 ,
						"unitCodeAssist": " ", //  (string, optional): 辅单位 ,
						"unitCodeNumberAssist": 0, //  (number, optional): 辅单位数量 ,
						"unitCode1": "", //  (string, optional): 副单位1 ,
						"unitCodeNumber1": 0, //  (number, optional): 副单位1数量 ,
						"unitCodeConvertRate1": 0, //  (number, optional): 副单位1转化率 ,
						"unitCode2": "", //  (string, optional): 副单位2 ,
						"unitCodeNumber2": 0, //  (number, optional): 副单位2数量 ,
						"unitCodeConvertRate2": 0, //  (number, optional): 副单位2转换率 ,
						"id": 0 //  (integer, optional): Id
					};
					outBuyInputDetail.push(SellOutputDetailInput);
					//dataModel.sellOutputDetail.push(SellOutputDetailInput);
				}
			}

			if(salesSourceType) {
				for(var i = 0; i < salesData.sellOutputDetail.length; i++) {
					dataModel.sellOutputDetail[i].sourceType = salesData.sellOutputDetail[i].sourceType || 0; //(integer): 来源类型 
					dataModel.sellOutputDetail[i].sourceSerial = salesData.sellOutputDetail[i].sourceSerial || ""; //(string, optional): 来源单号 ,
					dataModel.sellOutputDetail[i].sourceId = salesData.sellOutputDetail[i].sourceId || 0; //(integer): 来源id ,
					dataModel.sellOutputDetail[i].sourceItemId = salesData.sellOutputDetail[i].sourceItemId || 0; //(integer): 来源明细id ,
				}
			}

			return dataModel;
		}

		var option = {};
		//新增
		function create(dataModel) {
			if(dataModel.statusId == abp.statusId.Finish) {
				globalInit.buttonInit(".mui-btn-sub");
			}
			abp.services.app.sellOutput.create(dataModel, option)
				.done(function(data) {

					function locaHref() {
						document.location.href = "../outSales/index.html?dd_nav_bgcolor=FFFF943E";
					}
					if(dataModel.statusId == abp.statusId.Draft) {
						muiTips.alertTips(' ', "保存成功", 1, 3, locaHref);
						globalInit.buttonReset(".keep-draft");
					} else {

						muiTips.alertTips(' ', "提交成功", 1, 3, locaHref);
						globalInit.buttonReset(".mui-btn-sub");
					}

					clearSession();

				})
				.fail(function(data) {
					muiTips.alertTips(' ', data.message, 3, 3, "default");
					if(dataModel.statusId == abp.statusId.Draft) {
						globalInit.buttonReset(".keep-draft");
					} else {
						globalInit.buttonReset(".mui-btn-sub");
					}
				});
		}
		//编辑
		function update(dataModel) {
			if(dataModel.statusId == abp.statusId.Finish) {
				globalInit.buttonInit(".mui-btn-sub");
			}
			abp.services.app.sellOutput.update(dataModel, option)
				.done(function(data) {
					function locaUpdateHref() {
						document.location.href = "../../src/salesOrder/salesOrderDetail.html?dd_nav_bgcolor=FFFF943E";
					}
					if(dataModel.statusId == abp.statusId.Draft) {
						muiTips.alertTips(' ', "修改成功", 1, 3, locaUpdateHref);
						globalInit.buttonReset(".keep-draft");
					} else {
						muiTips.alertTips(' ', "提交成功", 1, 3, locaUpdateHref);
						globalInit.buttonReset(".mui-btn-sub");
					}
					clearSession();
				})
				.fail(function(data) {
					muiTips.alertTips(' ', data.message, 3, 3, "default");
					if(dataModel.statusId == abp.statusId.Draft) {
						globalInit.buttonReset(".keep-draft");
					} else {
						globalInit.buttonReset(".mui-btn-sub");
					}
				});
		}
		//提交审核
		mui("body").on("tap", ".mui-btn-sub", function() {
			globalInit.buttonInit(".mui-btn-sub");
			var dataModel = sellOrder(abp.statusId.Finish);
			//			if(sessionStorage.getItem("sellData")) { //由订单入口
			if(!dataModel.id || dataModel.id === undefined) {
				jurisdictionOrder.getJurisdiction(abp.sourceType.SELL, create, dataModel);
				sessionStorage.setItem("strStatusId", abp.statusId.Finish);
			} else {
				jurisdictionOrder.getJurisdiction(abp.sourceType.SELL, update, dataModel);
				sessionStorage.setItem("strStatusId", abp.statusId.Finish);
			}
			//			} else { //非订单入口
			//				if(!dataModel.id || dataModel.id === undefined) {
			//					jurisdictionOrder.getJurisdiction(abp.sourceType.SELL, create, dataModel);
			//					//create(dataModel);
			//					sessionStorage.setItem("strStatusId", abp.statusId.Finish);
			//				} else {
			//					jurisdictionOrder.getJurisdiction(abp.sourceType.SELL, update, dataModel);
			//					//update(dataModel);
			//					sessionStorage.setItem("strStatusId", abp.statusId.Finish);
			//				}
			//			}
		});
		//保存草稿
		mui("body").on("tap", ".keep-draft", function() {
			globalInit.buttonInit(".keep-draft");
			var dataModel = sellOrder(abp.statusId.Draft);
			if(!dataModel.id || dataModel.id === undefined) {
				create(dataModel);
				sessionStorage.setItem("strStatusId", abp.statusId.Draft);
			} else {
				update(dataModel);
				sessionStorage.setItem("strStatusId", abp.statusId.Draft);
			}

		});
		//设置计税参数配置
		mui("body").on("tap", ".setParm", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
		});

		function countFun() {
			var allPrice = Number($("#allPrice").text()); //产品总价
			var discount = ($(".discount").val() / 100); //折扣率

			var discountMoney = allPrice * (1 - discount);
			$("#discountMoney").val(discountMoney.toFixed(2));
			$("#cutAfterMoney").text((allPrice - discountMoney).toFixed(2));
		}
		$("body").on("keyup", ".discount", function() {
			countFun();
		});
		$("body").on("keyup", "#discountMoney", function() {
			var discountMoney = $("#discountMoney").val(); //折扣额
			var allPrice = Number($("#allPrice").text()); //产品总价
			var discount = (allPrice - discountMoney) / allPrice * 100;
			$(".discount").val(Math.round(discount.toFixed(2)));
		});

		//计算总金额总数量
		function settlement() {
			//总数量 总金额
			var allnumber, totalAmount;
			var arrays = [];
			var lastMoney = [];
			//遍历所有货品的数量
			$.each($("#goodsListShow .goodsNum"), function(i, v) {
				allnumber = Number($(v).text());
				arrays.push(allnumber);
			});
			//总数量
			//			console.log(lastMoney)
			for(var i = 0; i < arrays.length - 1; i++) {
				allnumber += arrays[i];
			}
			//		console.log(allnumber)
			$("#allNum").text(allnumber);
			//遍历所有货品的单金呢
			$.each($("#goodsListShow .product-money"), function(i, v) {
				totalAmount = Number($(v).attr("data-amount"));
				lastMoney.push(totalAmount);
			});
			//总金额
			for(var i = 0; i < lastMoney.length - 1; i++) {
				totalAmount += lastMoney[i];
			}
			//			console.log(totalAmount)
			$("#allPrice").text(Number(totalAmount).toFixed(2));
		}
		//记录计税方式ID
		mui("body").on("tap", "#goodsListShow .goodsIn-list", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
		});
		//清除缓存
		function clearSession() {
			sessionStorage.removeItem('serialNo');
			sessionStorage.removeItem('sellData');
			sessionStorage.removeItem('salDetID');
			sessionStorage.removeItem("chioceStaff");
			sessionStorage.removeItem("chioceStaffId");
			sessionStorage.removeItem("statusType");
			sessionStorage.removeItem("goodsInfoList");
			sessionStorage.removeItem("goodsUnit");
			sessionStorage.removeItem("salesData");
			sessionStorage.removeItem("flags");
			sessionStorage.removeItem("data-stockQuery");
			sessionStorage.removeItem("deliveryDate");
			sessionStorage.removeItem("clientId");
			sessionStorage.removeItem("chioceClientNameId");
			sessionStorage.removeItem("chioceClientName");
			sessionStorage.removeItem('createHome');
		}
		//钉钉返回
		require('http://g.alicdn.com/ilw/ding/0.8.9/scripts/dingtalk.js');
		//返回清除缓存
		var dingTalkNav = require('dd_config');
		//钉钉右边按钮操作
		dingTalkNav.RightNavBar(false, "新增", "default");
		//从销售记录生成时返回
		if(sessionStorage.getItem("sellData")) {
			//ios
			dingTalkNav.LeftNavBar(clearSessionDD);
			//ad
			dingTalkNav.leftAndroid(clearSessionDD);
			//生成
			dingTalkNav.setTitleText("生成销售出库");
		} else if(sessionStorage.getItem("salesData")) { //从销售出库记录编辑时返回
			//ios
			dingTalkNav.LeftNavBar(clearSessionDDSellOrder);
			//ad
			dingTalkNav.leftAndroid(clearSessionDDSellOrder);
			//编辑
			dingTalkNav.setTitleText("编辑销售出库");
		} else if(sessionStorage.getItem('createHome')) {
			//ios
			dingTalkNav.LeftNavBar(clearSessionDDHome);
			//ad
			dingTalkNav.leftAndroid(clearSessionDDHome);
			//新增
			dingTalkNav.setTitleText("新增销售出库");
		} else {
			//ios
			dingTalkNav.LeftNavBar(clearSessionDDCreate);
			//ad
			dingTalkNav.leftAndroid(clearSessionDDCreate);
			//新增
			dingTalkNav.setTitleText("新增销售出库");
		}
		//清除缓存
		function clearSessionDD() {
			clearSession();
			document.location.href = "../../src/salesOrder/salesOrderDetail.html?dd_nav_bgcolor=FFFF943E";
		}
		//清除缓存
		function clearSessionDDCreate() {
			clearSession();
			document.location.href = "../../src/outSales/index.html?dd_nav_bgcolor=FFFF943E";
		}

		function clearSessionDDSellOrder() {
			clearSession();
			document.location.href = "../../src/outSales/salesDetail.html?dd_nav_bgcolor=FFFF943E";
		}

		function clearSessionDDHome() {
			clearSession();
			document.location.href = "../../src/index.html?dd_nav_bgcolor=FFFF943E";
		}
		//添加标识
		mui("body").on("tap", "#goodsListShow .goodsIn-list", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
			sessionStorage.setItem("goodsIndex", $(this).attr("data-id"));
			sessionStorage.setItem("statusType", $(this).attr("data-status"));
			sessionStorage.removeItem("goodsId");
			sessionStorage.removeItem("localstatusType");
			sessionStorage.removeItem("chioce");
		});
		//设置计税参数配置
		mui("body").on("tap", ".product-goods", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
			sessionStorage.removeItem("localstatusType");
			sessionStorage.removeItem("statusType");
		});
		mui("body").on("tap", "#goodsListShow .goodsIn", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
			sessionStorage.setItem("goodsIndex", $(this).attr("data-id"));
			sessionStorage.setItem("localstatusType", $(this).attr("data-other"));
			sessionStorage.removeItem("goodsId");
			sessionStorage.removeItem("statusType");
			sessionStorage.removeItem("chioce");
		});

	});

	//判断是否启用审批
	var eHistory = require("eHistory");
	var isExamina = eHistory.funIsAuditSetting(abp.sourceType.SELL_OUTPUT, sourceId);
	if(isExamina === true) {
		$("#btnSubmitExamina").text("提交审核");
	} else {
		$("#btnSubmitExamina").text("提交");
	}

});